package com.wenchao.demoworkmanager.works;

import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.work.Data;
import androidx.work.Worker;
import androidx.work.WorkerParameters;

/**
 * @author zhangwenchao
 */
public class UploadLogWork extends Worker {

    public UploadLogWork(@NonNull Context context, @NonNull WorkerParameters workerParams) {
        super(context, workerParams);
        Data inputData = workerParams.getInputData();
        Log.d("super", "工作内容：" + inputData.getString("work_content"));
    }

    @NonNull
    @Override
    public Result doWork() {
        Log.d("super", "上传日志成功！");
        Data data = new Data.Builder().putString("work_result", "上传日志成功！").build();
        return Result.success(data);
    }
}
